<template>
  <!-- 跟进记录 -->
  <el-table :data="followRecordList" style="width: 100%">
    <el-table-column prop="content" label="跟进内容" min-width="100" />
    <el-table-column prop="progress" label="跟进进度" width="350" />
    <el-table-column prop="typeName" label="跟进类型" width="350">
      <!-- 0电话回访，1线下拜访，2线上联系 -->
      <!-- <template #default="scope">
        <p v-if="scope.row.type == 0">电话回访</p>
        <p v-if="scope.row.type == 1">线下拜访</p>
        <p v-if="scope.row.type == 2">线上联系</p>
      </template> -->
    </el-table-column>
    <el-table-column prop="nextTime" label="下次联系时间" width="350" />
  </el-table>
</template>

<script>
import { queryTypeByDic } from '@/utils/getData'
export default {
  name: 'followRecordList',
  data () {
    return {
      followRecordList: [],
      typeList: []
    }
  },
  props: {
    list: {
      type: Array,
      required: true,
      default: () => { return [] }
    }
  },
  watch: {
    list (val) {
      if (val) {
        this.followRecordList = val
        this.typeList.forEach(item => {
          this.followRecordList.map(f_item => {
            if (item.value == f_item.type) {
              f_item.typeName = item.name
            }
          })
        })
      }
    }
  },
  mounted () {
    this.getType()
  },
  methods: {
    // 获取跟进类型
    async getType () {
      let data = await queryTypeByDic('followType')
      this.typeList = data

    }
  }
}
</script>

<style>
</style>